//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "common\fn_getActions.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_object","_result","_filter","_i"];
_result = [];
DEFAULT_PARAM(_object,0,objNull);
DEFAULT_PARAM(_filter,1,nil);
_result = OGETVAR(_object,QGVAR(MISSION_ACTIONS),_result);
if (!isnil "_filter") then {
	if (typename _filter == typename 0) then {
		for "_i" from 0 to ((count _result) - 1) step 1 do {
			if (_filter != ([(_result select _i)] call FFUNC(actionGetID))) then {
				_result set [_i, "XxDeLxX"];
			};
		};
	};
	if (typename _filter == typename "") then {
		for "_i" from 0 to ((count _result) - 1) step 1 do {
			if (_filter != ([(_result select _i)] call FFUNC(actionGetType))) then {
				_result set [_i, "XxDeLxX"];
			};
		};
	};
	_result = _result - ["XxDeLxX"];
};
TRACE_1("End",_result);
TMFPROFILERSTOP;
_result;